﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace cmsservice.Common
{
    public class Cache
    {

        public static void Add(string key, object obj, DateTime expiredTime)
        {
            System.Web.HttpRuntime.Cache.Add(key, obj, null, expiredTime, TimeSpan.Zero, System.Web.Caching.CacheItemPriority.Low, null);
        }

        public static void Add(string key, object obj, DateTime expiredTime,System.Web.Caching.CacheItemRemovedCallback callback)
        {
            System.Web.HttpRuntime.Cache.Add(key, obj, null, expiredTime, TimeSpan.Zero, System.Web.Caching.CacheItemPriority.Low, callback);
        }

        public static T Get<T>(string key)
        {
            return (T)Get(key); ;
        }

        public static object Get(string key)
        {
            return System.Web.HttpRuntime.Cache.Get(key);
        }
    }
}
